package com;

import java.io.File;
import java.util.List;

import com.ecbt.util.UDFile;
import com.jcraft.jsch.ChannelSftp;

import cn.hutool.core.io.FileUtil;

public class DownloadFromFtp {

	public static void main(String[] args) {

		ChannelSftp ftp = UDFile.getConnectIP("118.178.86.19", "22", "root", "TAOAIjun19891008");
		
		List<String> paths = FileUtil.readLines(new File("D:\\projects\\工作目录\\版本\\7777-20240804-2\\LayOut\\Layer_OUT2.txt"), "UTF-8");
		for(String p : paths) {
			System.out.println(p);
			String fileName = p.substring(p.lastIndexOf("/") + 1);
			String date = fileName.substring(fileName.lastIndexOf("_"));
//			System.out.println(date);
			UDFile.download("/home/akeem/clddata/apache-tomcat-9.0.69/webapps/barcode" + p.substring(1, p.lastIndexOf("/")), fileName,
    		"D:\\projects\\工作目录\\版本\\7777-20240804-2\\LayOut\\SN_Layer_OUT" + date, ftp, false);
		}
		UDFile.closeFtp(ftp);
    }
}
